#include<string>
#include<iostream>
#include<mutex>
#include<cstdio>
#include<fstream>
#include <fcntl.h>
#include <unistd.h>
#include <sys/file.h>
#include<vector>
#include <semaphore.h>
#include <sys/stat.h>
  
class TestDataRecorder{
    private:
    //public:
    std::string path;
    std::string slice1 ="key:\"" ,slice2 = "\" Value:\"",slice3 = "\" [{KEY:\"",slice4 = "\" Value:\"",slice5 = "\",key:\"";
    std::string slice6 = "\" value:\"",slice7 =  "\",KEY:\"",slice8 =  "\",Value:\"",slice9 = "\" ,KEY:CPU Value:\"",slice10 = "\",KEY:\"MEM\" Value:\"",slice11 = "\"},]";
   // std::string current = "key ：\"场景名字\" Value： \"域内单发单收\" [{KEY:\"PUB\" Value: \"Service1\",key:\"time\" value:\"0.072612\",KEY:\"数据量\",Value:\"28Byte\" ,KEY:CPU Value:\"30%\",KEY：\"MEM\" Value:\"1M\"  }，]";
    
    void clear(int pid);

    public:
    TestDataRecorder(std::string path);//传入写入文件地址
    ~TestDataRecorder();
    //函数负责向指定地址写入数据
    bool write(std::string name1, std::string name2, std::string key1, std::string val1, std::string key2, std::string val2, std::string key3, std::string val3);
    bool write(std::string read_back, std::string name1, std::string name2);
    std::vector<std::string> read(int id);//读取指定进程的文件数据
    //bool is_content();//判断指定进程的文件是否为空

 };










